<script>
export default {
  name: "Diagnostic",
  data() {
    return {
      patientList: [

      ],
      dialogVisible: false,
      form: {},

    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.$axios.post("http://localhost:8000/medic/diagnostic/1/").then(res => {
        // console.log(res)
        this.patientList = res.data.patientList
      })
      // console.log(this.patientList)
    },
    detail(patient) {
      this.form = patient
      this.dialogVisible = true
    }
  }
}
</script>

<template>
  <div>
    <el-row :gutter="24">
      <el-col :span="12" v-for="(patient, index) in this.patientList" :key="patient.pid">
        <el-card :body-style="{padding: '10px'}">
          <div style="margin: 10px;">
            <span>病人姓名:{{patient.name}}</span><br>
            <span>病情简介:{{patient.chief}}</span><br>
            <span>病人年龄:{{patient.age}}</span><br>
            <el-button type="text"  @click="detail(patient)">查看病人详情 </el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
  <el-dialog
      v-model="dialogVisible"
      title="详情"
      width="90%">
    <el-card>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item style="width: 35%" label="病人名:">
          <el-input v-model="form.name" disabled></el-input>
        </el-form-item>
        <td style="width: 480px">
          <el-form-item style="width: 35%" label="病情:">
            <el-input v-model="form.message" disabled></el-input>
          </el-form-item>
        </td>
      </el-form>
    </el-card>

  </el-dialog>
</template>

<style scoped>

</style>